from django.db import models

# Create your models here.

class Test(models.Model):
    name = models.CharField(max_length=20)


class Contact(models.Model):
    name = models.CharField(max_length=200)
    age = models.IntegerField(default=0)
    email = models.EmailField()#比较新奇，等生成表再看看什么样
    #不是很理解这个方法，整理编码格式用的？
#    def __unicode__(self):
    #百度后发现，原来是过时的方法，相当于tostring
    def __str__(self):
        return self.name


class Tag(models.Model):
    contact = models.ForeignKey(Contact, on_delete=models.CASCADE, )
    name = models.CharField(max_length=50)

    def __str__(self):
    # def __unicode__(self):
        return self.name